﻿<!DOCTYPE HTML >
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD><TITLE>租房 - 用户注册</TITLE>
    <META content="text/html; charset=utf-8" http-equiv=Content-Type>
    <LINK rel=stylesheet type="text/css" href="css/style.css">
    <META name=GENERATOR content="MSHTML 8.00.7601.17514">
    <script type="text/javascript" src="js/jQery-3.6.0.min.js" charset="UTF-8"></script>
</HEAD>
<BODY>
<DIV id=header class=wrap>
    <DIV id=logo>
        <IMG src="images/logo.gif">
    </DIV>
</DIV>
<DIV id=regLogin class=wrap>
    <DIV class=dialog>
        <DL class=clearfix>
            <DT>新用户注册</DT>
            <DD class=past>填写个人信息</DD>
        </DL>
        <DIV class=box>
            <FORM action="regUser.do" method="post">
                <DIV class=infos>
                    <TABLE class=field>
                        <TBODY>
                        <TR>
                            <TD class=field>用 户 名：</TD>
                            <TD><INPUT autocomplete="off" class="name" type="text" name="nickName">
                            <span id="span"></span></TD>
                        </TR>
                        <TR>
                            <TD class=field>密　　码：</TD>
                            <TD><INPUT  autocomplete="off" class="password" type=password name="password"></TD>
                        </TR>
                        <TR>
                            <TD class=field>确认密码：</TD>
                            <TD><INPUT autocomplete="off" id="repassword" type=password name="repassword">
                            <span id="checkpwd"></span>
                            </TD>
                        </TR>
                        <TR>
                            <TD class=field>电　　话：</TD>
                            <TD><INPUT autocomplete="off" class="telephone" type=text name="phone"></TD>
                        </TR>
                        <TR>
                            <TD class=field>用户姓名：</TD>
                            <TD><INPUT autocomplete="off" class="username" type=text name="userName"></TD>
                        </TR>
                        </TBODY>
                    </TABLE>
                    <DIV class=buttons>
                        <INPUT value=立即注册 type="submit">
                    </DIV>
                </DIV>
            </FORM>
        </DIV>
    </DIV>
</DIV>
<DIV id=footer class=wrap>
    <DL>
        <DT>租房 © 2010 京ICP证1000001号</DT>
        <DD>关于我们 · 联系方式 · 意见反馈 · 帮助中心</DD>
    </DL>
</DIV>
</BODY>
    <script>
         $(function (){
             $('.name').blur(function (){
                 let value =$('.name').val();
                 $.ajax({
                     type:"post",
                     url:"checkName.do",
                     data:{nickName:value},
                     success:function (data){
                         if (data=="true"){
                             $('#span').html("用户名已经存在").css({'font-size': '14px','color':'red'});
                         }else {
                             $('#span').html("用户名可以使用").css({'font-size': '14px','color':'green'});
                         }
                     }
                 })
             });
             $('#repassword').blur(function (){
                 let pwd =  $(".password").val();
                 let repwd = document.getElementById("repassword").value;

                 if (pwd != repwd){
                     $("#checkpwd").html("两次密码输入不一致").css({'font-size': '14px','color':'red'})
                 }else {
                     $("#checkpwd").html("两次密码输入一致").css({'font-size': '14px','color':'green'})
                 }
             });
         })
    </script>
</HTML>
